<?php 

if(isset($_POST['text']) && isset($_POST['choix']))
{
	
		$text = $_POST['text'];
		$choix = $_POST['choix'];
		$connexion = sql_connecter();

		if($choix == "tutoriel")
		{
			$requete = "SELECT * FROM tutoriels WHERE titre_tutoriel LIKE '%$text%'";		
		}
		elseif($choix == "question")
		{
			$requete = "SELECT * FROM questions WHERE titre_question LIKE '%$text%'";			
		}
		elseif($choix == "reponse")
		{
			$requete = "SELECT * FROM reponses WHERE contenu_reponse LIKE '%$text%'";	
		}
		elseif($choix == "news")
		{
			$requete = "SELECT * FROM news WHERE titre_news LIKE '%$text%'";			
		}
		elseif($choix == "all")
		{
			
		}

		$resultat = sql_executer($connexion, $requete);
		while($ligne = sql_lire_ligne_tableau($resultat))
		{
			printf("Un résultat : $ligne->titre_%s", $choix);
		}
		
}

?>